<!DOCTYPE html>
<html>
  <head>
    <meta charset='utf-8'>
    <meta content='width=device-width, initial-scale=1.0' name='viewport'>
    <meta content='' name='description'>
    <meta content='Nils Nordman' name='author'>
    <link href='/images/howl.png' rel='shortcut icon'>
    <title>Howl :: Running external commands</title>
    <link href="/stylesheets/bootstrap.min.css" media="screen" rel="stylesheet" type="text/css" />
    <link href="/stylesheets/syntax.css" media="screen" rel="stylesheet" type="text/css" />
    <link href="/stylesheets/howl.css" media="screen" rel="stylesheet" type="text/css" />
    <link href='//fonts.googleapis.com/css?family=Josefin+Slab' rel='stylesheet' type='text/css'>
    <link href='//fonts.googleapis.com/css?family=Open+Sans+Condensed:700' rel='stylesheet' type='text/css'>
  </head>
  <body class='doc doc_manual doc_manual_running_commands'>
    <div class='container'>
      <div class='masthead'>
        <ul class='nav nav-pills'>
          <li>
            <a href='/'>
              <span class='glyphicon glyphicon-home'></span>
              Home
            </a>
          </li>
          <li>
            <a href='/doc/'>
              <span class='glyphicon glyphicon-book'></span>
              Documentation
            </a>
          </li>
          <li>
            <a href='/blog/'>
              <span class='glyphicon glyphicon-bullhorn'></span>
              Blog
            </a>
          </li>
          <li>
            <a href='/contact.html'>
              <span class='glyphicon glyphicon-inbox'></span>
              Contact
            </a>
          </li>
        </ul>
      </div>
      <ol class="breadcrumb"><li><a href="/">Home</a></li><li><a href='../'>Howl 0.3 Documentation</a></li><li>Manual</li><li>Running external commands</li></ol>
      <h1 id="running-external-commands">Running external commands</h1>    <div class="toc">
      <div class="toc-title">
        <span>Running external commands</span>
      </div>
      <div class="toc-entries">
<div class="toc-group">
<a href="#overview" class="toc-group-header overview">Overview</a>
</div>
<div class="toc-group">
<a href="#interacting-with-the-prompt" class="toc-group-header interacting_with_the_prompt">Interacting with the prompt</a>
</div>
<div class="toc-group">
<a href="#running-commands" class="toc-group-header running_commands">Running commands</a>
</div>
<div class="toc-group">
<a href="#project-build" class="toc-group-header project-build">project-build</a>
</div>
<div class="toc-group">
<a href="#dealing-with-rogue-commands" class="toc-group-header dealing_with_rogue_commands">Dealing with rogue commands</a>
</div>
</div>
</div>
&#x000A;&#x000A;<h2 id="overview">Overview</h2>&#x000A;&#x000A;<p>While most of the time spent developing is likely to be editing, there&rsquo;s often a&#x000A;need for running external commands, such as compilers, test, etc., as part of&#x000A;the work flow. Howl provides two different commands for this purpose, <code>exec</code> and&#x000A;<code>project-exec</code>, bound to <code>ctrl_shift_r</code> and <code>ctrl_alt_r</code> respectively. They both&#x000A;work the same way, allowing you execute a command of your choice from within a&#x000A;directory, displaying any output in a buffer. The difference is that&#x000A;<code>project-exec</code> starts out from from the root of your current project directory,&#x000A;while <code>exec</code> starts out in the directory associated with the current buffer.</p>&#x000A;&#x000A;<h2 id="interacting-with-the-prompt">Interacting with the prompt</h2>&#x000A;&#x000A;<p><img alt="Exec prompt" src="/images/doc/exec-prompt.png" /></p>&#x000A;&#x000A;<p>Upon executing one of the above commands, you&rsquo;ll end up in the prompt. The&#x000A;prompt offers specific completions and ways of making it easier to input your&#x000A;command. Just as with the ordinary prompt for opening a file, you can enter&#x000A;<code>backspace</code> to move up one directory level. Entering <code>~</code> and <code>/</code> allows you to&#x000A;quickly run a command from your home directory, or the root directory,&#x000A;respectively. Completions are available both for commands themselves as well as&#x000A;arguments, and support completion of arguments spanning multiple directory&#x000A;levels (e.g. <code>./my-dir/sub-dir/foo</code>).</p>&#x000A;&#x000A;<p>As a final convenience, the prompt supports an internal <code>cd</code> command, allowing&#x000A;you to move to a different directory within the prompt.</p>&#x000A;&#x000A;<h2 id="running-commands">Running commands</h2>&#x000A;&#x000A;<p>Once you have typed your command, you can run it by pressing <code>enter</code>. Both the&#x000A;<code>exec</code> and <code>project-exec</code> commands will launch the specified command in the&#x000A;directory displayed in the prompt, using your shell. The fact that your shell is&#x000A;used for this allows for the use of any ordinary shell aliases you normally use&#x000A;(provided that they are available for non-login shells), as well as shell&#x000A;constructs such as for loops, etc.</p>&#x000A;&#x000A;<p>The command thus launched will be associated with a new buffer, in which any&#x000A;output from the command will be displayed. Commands will not block the editor&#x000A;while running, so you&rsquo;re free to resume your other tasks while the the command&#x000A;runs. There is also no limitation on the number of concurrently executing&#x000A;commands you might have - they will all be associated with their own buffers&#x000A;that you can switch between as you please, as illustrated by the below image.</p>&#x000A;&#x000A;<p><img alt="Concurrent commands" src="/images/doc/concurrent-commands.png" /></p>&#x000A;&#x000A;<p>Also illustrated by the above image is the fact that Howl adds some extra&#x000A;support for displaying a command&rsquo;s output, with the example in question showing&#x000A;off Howl&rsquo;s support for ANSI color escape codes. For less fanciful commands Howl&#x000A;will display any standard output plainly, while error output will be shown in a&#x000A;different style to allow you to quickly differentiate between the two.</p>&#x000A;&#x000A;<h2 id="project-build">project-build</h2>&#x000A;&#x000A;<p>Howl features another execution command, <code>project-build</code>, bound to <code>ctrl_shift_b</code>. This is the same as&#x000A;<code>project-exec</code>, but it executes the command defined in <code>config.project_build_command</code>.</p>&#x000A;&#x000A;<h2 id="dealing-with-rogue-commands">Dealing with rogue commands</h2>&#x000A;&#x000A;<p>While a well behaved command will exit on its own, occasionally there are those&#x000A;that need an helping hand. Pressing <code>Ctrl + c</code> when in a process buffer will&#x000A;send the <code>SIGINT</code> signal to the currently running process, hopefully hastening&#x000A;its way towards a graceful exit (<code>Ctrl + c</code> while a selection is active will&#x000A;still only copy the selection). For the obstinate cases, <code>Ctrl + backslash</code> can&#x000A;be used to send the <code>SIGKILL</code> signal.</p>&#x000A;&#x000A;<hr>&#x000A;&#x000A;<p><em>Next</em>: <a href="next.html">What&rsquo;s next?</a></p>
      <div class='footer text-muted'>
        <a href='/'>
          <img width="50" height="50" class="footer-logo" src="/images/howl.png" />
        </a>
        <div class='footer-follow'>
          <p>
            <a class='twitter-follow-button' data-lang='en' data-show-count='false' href='https://twitter.com/howleditor' rel='me'>
              Follow @howleditor
            </a>
          </p>
          <p>
            <a class='twitter-share-button' data-count='none' data-hashtags='howleditor' data-lang='en' data-text='The Howl Editor, a general purpose, light-weight customizable editor.' data-url='http://howl.io' href='https://twitter.com/share'>
              Tweet
            </a>
          </p>
        </div>
        <div class='footer-blurb'>
          <div>The Howl editor.</div>
          <div>
            Copyright 2012-2015
            <a class='alert-link' href='https://github.com/nilnor/howl/contributors'>
              The Howl Developers.
            </a>
          </div>
        </div>
      </div>
    </div>
    <script>
      <!-- / GA -->
      (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
      m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
      })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
      ga('create', 'UA-45283282-1', 'howl.io');
      ga('send', 'pageview');
      <!-- / Twitter -->
      !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];
      if(!d.getElementById(id)){js=d.createElement(s);js.id=id;
      js.src="//platform.twitter.com/widgets.js";
      fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");
    </script>
  </body>
</html>
